home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume11 / reve / patch3h < prev    next >
Encoding:
Internet Message Format  |  1991-01-03  |  44.1 KB

  1. Path: uunet!zephyr.ens.tek.com!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v12i008:  reve - an othello game, Patch3h
  5. Message-ID: <6766@tekred.CNA.TEK.COM>
  6. Date: 21 Dec 90 20:52:54 GMT
  7. Sender: news@tekred.CNA.TEK.COM
  8. Lines: 1599
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: Rich Burridge <rburridge@sun.COM>
  12. Posting-number: Volume 12, Issue 8
  13. Archive-name: reve/Patch3h
  14. Patch-To: reve: Volume 11, Issue 52-58
  15. Environment: SunView, XView, X11R4, termcap
  16.  
  17.  
  18.  
  19. #! /bin/sh
  20. # This is a shell archive.  Remove anything before this line, then unpack
  21. # it by saving it into a file and typing "sh file".  To overwrite existing
  22. # files, type "sh file -c".  You can also feed this as standard input via
  23. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  24. # will see the following message at the end:
  25. #        "End of archive 8 (of 9)."
  26. # Contents:  patches03e
  27. # Wrapped by billr@saab on Fri Dec 21 11:28:05 1990
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'patches03e' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'patches03e'\"
  31. else
  32. echo shar: Extracting \"'patches03e'\" \(41748 characters\)
  33. sed "s/^X//" >'patches03e' <<'END_OF_FILE'
  34. X
  35. X------- sunview.c -------
  36. X*** /tmp/da07669    Sun Dec  9 15:20:11 1990
  37. X--- sunview.c    Sat Dec  8 13:28:38 1990
  38. X***************
  39. X*** 60,65 ****
  40. X--- 60,67 ----
  41. X  mpr_static(cycle_rinvert_pr,  64, 64, 1, cycle_rinvert_image) ;
  42. X  mpr_static(icon_pr,           64, 64, 1, icon_image) ;
  43. X  mpr_static(cicon_pr,          64, 64, 8, cicon_image) ;
  44. X+ mpr_static(toggle_off_pr,     64, 64, 1, sch_off_image) ;
  45. X+ mpr_static(toggle_on_pr,      64, 64, 1, sch_on_image) ;
  46. X  mpr_static(white_icon_pr,     64, 64, 1, white_image) ;
  47. X  mpr_static(black_icon_pr,     64, 64, 1, black_image) ;
  48. X  
  49. X***************
  50. X*** 66,80 ****
  51. X  mpr_static(hglass_pr,         16, 16, 1, hglass_image) ;
  52. X  mpr_static(nocur_pr,          16, 16, 1, nocur_image) ;
  53. X  
  54. X! Canvas canvas ;
  55. X  Cursor cursor[MAXCURSORS] ;
  56. X  Event *cur_event ;
  57. X! Frame frame ;
  58. X  Icon reve_icon ;
  59. X- Menu menus[MAXMENUS] ;
  60. X  Pixfont *font[MAXFONTS] ;
  61. X  Pixrect *images[MAXIMAGES] ;
  62. X! Pixwin *cpw ;
  63. X  
  64. X  void pw_batch() ;
  65. X  int opvals[3] ;         /* Pixrect rasterop values. */
  66. X--- 68,81 ----
  67. X  mpr_static(hglass_pr,         16, 16, 1, hglass_image) ;
  68. X  mpr_static(nocur_pr,          16, 16, 1, nocur_image) ;
  69. X  
  70. X! Canvas canvas, pcanvas ;
  71. X  Cursor cursor[MAXCURSORS] ;
  72. X  Event *cur_event ;
  73. X! Frame frame, pframe ;
  74. X  Icon reve_icon ;
  75. X  Pixfont *font[MAXFONTS] ;
  76. X  Pixrect *images[MAXIMAGES] ;
  77. X! Pixwin *cpw, *ppw ;
  78. X  
  79. X  void pw_batch() ;
  80. X  int opvals[3] ;         /* Pixrect rasterop values. */
  81. X***************
  82. X*** 95,144 ****
  83. X  
  84. X  /*ARGSUSED*/
  85. X  void
  86. X! canvas_proc(canvas, event)
  87. X! Canvas canvas ;
  88. X  Event *event ;
  89. X  {
  90. X    cur_event = event ;
  91. X-   process_event() ;       /* Determine what kind of event it is. */
  92. X    handle_event() ;        /* And do the appropriate action. */
  93. X  }
  94. X  
  95. X  
  96. X  void
  97. X! close_frame()        /* Iconise reve window. */
  98. X  {
  99. X!   WINDOW_SET(frame, FRAME_CLOSED, TRUE, 0) ;
  100. X  }
  101. X  
  102. X  
  103. X  void
  104. X! color_area(x, y, width, height, color)
  105. X  int x, y, width, height, color ;
  106. X  {
  107. X!   PW_WRITEBACKGROUND(cpw, x, y, width, height, PIX_SRC | PIX_COLOR(color)) ;
  108. X! }
  109. X  
  110. X! 
  111. X! void
  112. X! create_menu(mtype, values)    /* Create popup menus for cycle items. */
  113. X! enum panel_type mtype ;
  114. X! char *values[] ;
  115. X! {
  116. X!   int i = 0 ;
  117. X!   int menuno ;     /* Current menu number. */
  118. X!   int more = 1 ;   /* Cleared when current menu is complete.*/
  119. X! 
  120. X!   menuno = (int) mtype - (int) BLACK_PLAYS ;
  121. X!   menus[menuno] = menu_create(MENU_FONT, font[(int) NFONT], 0) ;
  122. X!   do
  123. X!     {
  124. X!       if (values[i] != NULL)
  125. X!         MENU_SET(menus[menuno], MENU_STRING_ITEM, values[i], i+1, 0) ;
  126. X!       else more = 0 ;
  127. X!       i++ ;
  128. X!     }
  129. X!   while (more) ;
  130. X  }
  131. X  
  132. X  
  133. X--- 96,134 ----
  134. X  
  135. X  /*ARGSUSED*/
  136. X  void
  137. X! canvas_proc(c, event)
  138. X! Canvas c ;
  139. X  Event *event ;
  140. X  {
  141. X+        if (c == canvas)  curwin = W_MAIN ;
  142. X+   else if (c == pcanvas) curwin = W_PROPS ;
  143. X+ 
  144. X    cur_event = event ;
  145. X    handle_event() ;        /* And do the appropriate action. */
  146. X  }
  147. X  
  148. X  
  149. X  void
  150. X! close_frame(wtype)        /* Iconise reve window. */
  151. X! enum win_type wtype ;
  152. X  {
  153. X!   Frame f ;
  154. X! 
  155. X!   if (wtype == W_MAIN) f = frame ;
  156. X!   else                 f = pframe ;
  157. X!   WINDOW_SET(f, FRAME_CLOSED, TRUE, 0) ;
  158. X  }
  159. X  
  160. X  
  161. X  void
  162. X! color_area(wtype, x, y, width, height, color)
  163. X! enum win_type wtype ;
  164. X  int x, y, width, height, color ;
  165. X  {
  166. X!   Pixwin *pw ;
  167. X  
  168. X!   pw = (wtype == W_MAIN) ? cpw : ppw ;
  169. X!   PW_WRITEBACKGROUND(pw, x, y, width, height, PIX_SRC | PIX_COLOR(color)) ;
  170. X  }
  171. X  
  172. X  
  173. X***************
  174. X*** 149,210 ****
  175. X  }
  176. X  
  177. X  
  178. X- do_menu(mtype)      /* Popup appropriate cycle menu and get value. */
  179. X- enum panel_type mtype ;
  180. X- {
  181. X-   int menuno ;
  182. X- 
  183. X-   menuno = (int) mtype - (int) BLACK_PLAYS ;
  184. X-   return((int) menu_show(menus[menuno], canvas,
  185. X-                           canvas_window_event(canvas, cur_event), 0)) ;
  186. X- }
  187. X- 
  188. X- 
  189. X  void
  190. X! draw_image(x, y, width, height, image)
  191. X  int x, y, width, height ;               
  192. X  enum image_type image ;   
  193. X  {                        
  194. X!   PW_ROP(cpw, x, y, width, height, PIX_SRC | PIX_DST,
  195. X           images[(int) image], 0, 0) ;
  196. X  }
  197. X  
  198. X  
  199. X  void
  200. X! draw_line(x1, y1, x2, y2, op, color)
  201. X  int x1, y1, x2, y2, color ;
  202. X  enum optype op ;
  203. X  {
  204. X    int rop ;
  205. X  
  206. X    rop = opvals[(int) op] ;
  207. X    if (!iscolor[(int) cur_dpyno] && color == C_WHITE)
  208. X      rop = opvals[(int) RCLR] ;
  209. X!   PW_VECTOR(cpw, x1, y1, x2, y2, rop | PIX_COLOR(color), 1) ;
  210. X  }
  211. X  
  212. X  
  213. X  void
  214. X! draw_stencil(x, y, width, height, op, color, stencil, image)
  215. X  int x, y, width, height, color ;
  216. X  enum optype op ;
  217. X  enum image_type stencil, image ;
  218. X  {
  219. X    int rop ;
  220. X  
  221. X    rop = opvals[(int) op] | PIX_COLOR(color) ;
  222. X!   PW_STENCIL(cpw, x, y, width, height, rop,
  223. X               images[(int) stencil], 0, 0, images[(int) image], 0, 0) ;
  224. X  }
  225. X  
  226. X  
  227. X  void
  228. X! draw_text(x, y, ftype, color, str)
  229. X  enum font_type ftype ;
  230. X  int x, y, color ;
  231. X  char *str ;
  232. X  {
  233. X!   PW_TTEXT(cpw, x, y, PIX_SRC | PIX_COLOR(color), font[(int) ftype], str) ;
  234. X  }
  235. X  
  236. X  
  237. X--- 139,203 ----
  238. X  }
  239. X  
  240. X  
  241. X  void
  242. X! draw_image(wtype, x, y, width, height, image)
  243. X! enum win_type wtype ;
  244. X  int x, y, width, height ;               
  245. X  enum image_type image ;   
  246. X  {                        
  247. X!   Pixwin *pw ;
  248. X! 
  249. X!   pw = (wtype == W_MAIN) ? cpw : ppw ;
  250. X!   PW_ROP(pw, x, y, width, height, PIX_SRC | PIX_DST,
  251. X           images[(int) image], 0, 0) ;
  252. X  }
  253. X  
  254. X  
  255. X  void
  256. X! draw_line(wtype, x1, y1, x2, y2, op, color)
  257. X! enum win_type wtype ;
  258. X  int x1, y1, x2, y2, color ;
  259. X  enum optype op ;
  260. X  {
  261. X+   Pixwin *pw ;
  262. X    int rop ;
  263. X  
  264. X+   pw = (wtype == W_MAIN) ? cpw : ppw ;
  265. X    rop = opvals[(int) op] ;
  266. X    if (!iscolor[(int) cur_dpyno] && color == C_WHITE)
  267. X      rop = opvals[(int) RCLR] ;
  268. X!   PW_VECTOR(pw, x1, y1, x2, y2, rop | PIX_COLOR(color), 1) ;
  269. X  }
  270. X  
  271. X  
  272. X  void
  273. X! draw_stencil(wtype, x, y, width, height, op, color, stencil, image)
  274. X! enum win_type wtype ;
  275. X  int x, y, width, height, color ;
  276. X  enum optype op ;
  277. X  enum image_type stencil, image ;
  278. X  {
  279. X+   Pixwin *pw ;
  280. X    int rop ;
  281. X  
  282. X+   pw = (wtype == W_MAIN) ? cpw : ppw ;
  283. X    rop = opvals[(int) op] | PIX_COLOR(color) ;
  284. X!   PW_STENCIL(pw, x, y, width, height, rop,
  285. X               images[(int) stencil], 0, 0, images[(int) image], 0, 0) ;
  286. X  }
  287. X  
  288. X  
  289. X  void
  290. X! draw_text(wtype, x, y, ftype, color, str)
  291. X! enum win_type wtype ;
  292. X  enum font_type ftype ;
  293. X  int x, y, color ;
  294. X  char *str ;
  295. X  {
  296. X!   Pixwin *pw ;
  297. X! 
  298. X!   pw = (wtype == W_MAIN) ? cpw : ppw ;
  299. X!   PW_TTEXT(pw, x, y, PIX_SRC | PIX_COLOR(color), font[(int) ftype], str) ;
  300. X  }
  301. X  
  302. X  
  303. X***************
  304. X*** 225,230 ****
  305. X--- 218,231 ----
  306. X  }
  307. X  
  308. X  
  309. X+ char *
  310. X+ get_resource(rtype)      /* Null routine (currently only X11 and XView). */
  311. X+ enum res_type rtype ;
  312. X+ {
  313. X+   return((char *) NULL) ;
  314. X+ }
  315. X+ 
  316. X+ 
  317. X  get_strwidth(ftype, str)    /* Get width in pixels of string value. */
  318. X  enum font_type ftype ;
  319. X  char *str ;
  320. X***************
  321. X*** 246,251 ****
  322. X--- 247,259 ----
  323. X  }
  324. X  
  325. X  
  326. X+ init_graphics(argc, argv)
  327. X+ int *argc ;
  328. X+ char *argv[] ;
  329. X+ {
  330. X+ }
  331. X+ 
  332. X+ 
  333. X  init_ws_type()
  334. X  {
  335. X    if (getenv("WINDOW_PARENT") == NULL)
  336. X***************
  337. X*** 284,289 ****
  338. X--- 292,303 ----
  339. X  
  340. X  
  341. X  void
  342. X+ load_resources()     /* Dummy routine; used with X11 and XView versions. */
  343. X+ {
  344. X+ }
  345. X+ 
  346. X+ 
  347. X+ void
  348. X  lock_screen(state)   /* Turn graphics locking on or off. */
  349. X  enum bltype state ;
  350. X  {
  351. X***************
  352. X*** 306,312 ****
  353. X                           WIN_HEIGHT,      TOTAL_HEIGHT,
  354. X                           WIN_WIDTH,       TOTAL_WIDTH,
  355. X                           WIN_CONSUME_PICK_EVENTS,
  356. X!                            MS_LEFT, MS_MIDDLE, MS_RIGHT,
  357. X                             LOC_MOVE, LOC_DRAG, LOC_TRAJECTORY,
  358. X                             LOC_WINENTER, LOC_WINEXIT,
  359. X                             0,
  360. X--- 320,326 ----
  361. X                           WIN_HEIGHT,      TOTAL_HEIGHT,
  362. X                           WIN_WIDTH,       TOTAL_WIDTH,
  363. X                           WIN_CONSUME_PICK_EVENTS,
  364. X!                            MS_LEFT, MS_MIDDLE,
  365. X                             LOC_MOVE, LOC_DRAG, LOC_TRAJECTORY,
  366. X                             LOC_WINENTER, LOC_WINEXIT,
  367. X                             0,
  368. X***************
  369. X*** 316,321 ****
  370. X--- 330,350 ----
  371. X                           WIN_EVENT_PROC, canvas_proc,
  372. X                           0) ;
  373. X    cpw = (Pixwin *) window_get(canvas, CANVAS_PIXWIN) ;
  374. X+ 
  375. X+   pcanvas = window_create(pframe, CANVAS,
  376. X+                           CANVAS_RETAINED, FALSE,
  377. X+                           WIN_HEIGHT,      PROPS_HEIGHT,
  378. X+                           WIN_WIDTH,       PROPS_WIDTH,
  379. X+                           WIN_CONSUME_PICK_EVENTS,
  380. X+                             MS_LEFT, MS_MIDDLE,
  381. X+                             0,
  382. X+                           WIN_CONSUME_KBD_EVENTS,
  383. X+                             KBD_USE, KBD_DONE, WIN_ASCII_EVENTS, WIN_UP_EVENTS,
  384. X+                             0,
  385. X+                           WIN_EVENT_PROC, canvas_proc,
  386. X+                           0) ;
  387. X+   ppw = (Pixwin *) window_get(pcanvas, CANVAS_PIXWIN) ;
  388. X+ 
  389. X    cursor[(int) CANVASCUR] = window_get(canvas, WIN_CURSOR) ;
  390. X    CURSOR_SET(cursor[(int) CANVASCUR], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ;
  391. X    cursor[(int) HOURGLASS] = cursor_create(CURSOR_IMAGE, &hglass_pr, 0) ;
  392. X***************
  393. X*** 333,338 ****
  394. X--- 362,369 ----
  395. X    images[(int) CY_RINVERT]  = &cycle_rinvert_pr ;
  396. X    images[(int) P_WHITE]     = &white_icon_pr ;
  397. X    images[(int) P_BLACK]     = &black_icon_pr ;
  398. X+   images[(int) TOGGLE_OFF]  = &toggle_off_pr ;
  399. X+   images[(int) TOGGLE_ON]   = &toggle_on_pr ;
  400. X  }
  401. X  
  402. X  
  403. X***************
  404. X*** 352,357 ****
  405. X--- 383,396 ----
  406. X                           WIN_ERROR_MSG,    "Can't create window.",
  407. X                           FRAME_ARGS,       argc, argv,
  408. X                           0) ;
  409. X+ 
  410. X+   pframe = window_create((Window) NULL,     FRAME,
  411. X+                           FRAME_ICON,       reve_icon,
  412. X+                           FRAME_LABEL,      "reve properties",
  413. X+                           FRAME_NO_CONFIRM, TRUE,
  414. X+                           WIN_ERROR_MSG,    "Can't create window.",
  415. X+                           FRAME_ARGS,       argc, argv,
  416. X+                           0) ;
  417. X  }
  418. X  
  419. X  
  420. X***************
  421. X*** 363,368 ****
  422. X--- 402,419 ----
  423. X  
  424. X  
  425. X  void
  426. X+ open_frame(wtype)
  427. X+ enum win_type wtype ;
  428. X+ {
  429. X+   Frame f ;
  430. X+ 
  431. X+   if (wtype == W_MAIN) f = frame ;
  432. X+   else                 f = pframe ;
  433. X+   WINDOW_SET(f, WIN_SHOW, TRUE, 0) ;
  434. X+ }
  435. X+ 
  436. X+ 
  437. X+ void
  438. X  process_event()       /* Process the next canvas event. */
  439. X  {
  440. X    int id ;
  441. X***************
  442. X*** 393,399 ****
  443. X    else if (id == LOC_WINENTER || id == LOC_RGNENTER) nextc = ENTER_WINDOW ;
  444. X    else if (id == LOC_MOVE || id == LOC_DRAG || id == LOC_TRAJECTORY)
  445. X      nextc = MOUSE_MOVING ;
  446. X!   else if (id == WIN_REPAINT) nextc = FRAME_REPAINT ;
  447. X  }
  448. X  
  449. X  
  450. X--- 444,454 ----
  451. X    else if (id == LOC_WINENTER || id == LOC_RGNENTER) nextc = ENTER_WINDOW ;
  452. X    else if (id == LOC_MOVE || id == LOC_DRAG || id == LOC_TRAJECTORY)
  453. X      nextc = MOUSE_MOVING ;
  454. X!   else if (id == WIN_REPAINT)
  455. X!     {
  456. X!            if (curwin == W_MAIN) nextc = FRAME_REPAINT ;
  457. X!       else if (curwin == W_PROPS) nextc = PROPS_REPAINT ;
  458. X!     }
  459. X  }
  460. X  
  461. X  
  462. X***************
  463. X*** 417,421 ****
  464. X--- 472,477 ----
  465. X        WINDOW_SET(frame, FRAME_ICON, reve_icon, 0) ;
  466. X      }
  467. X    window_fit(frame) ;
  468. X+   window_fit(pframe) ;
  469. X    window_main_loop(frame) ;
  470. X  }
  471. X
  472. X------- tty.c -------
  473. X*** /tmp/da07672    Sun Dec  9 15:20:12 1990
  474. X--- tty.c    Sun Dec  9 12:44:57 1990
  475. X***************
  476. X*** 30,39 ****
  477. X  #include <signal.h>
  478. X  
  479. X  #ifdef SYSV
  480. X- #include <string.h>
  481. X  #include <sgtty.h>
  482. X- #else
  483. X- #include <strings.h>
  484. X  #endif /*SYSV*/
  485. X  
  486. X  #define  DRAW_STRING(col, row, str, v)  draw_string(col, row, str, v), return
  487. X--- 30,36 ----
  488. X***************
  489. X*** 65,87 ****
  490. X  } ;
  491. X  
  492. X  struct tty_info ttyvals[MAXITEMS] = {
  493. X!       {  1,  1,  33,  33, },      /* Load */
  494. X!       { 11,  1, 107,  33, },      /* New game */
  495. X!       { 22,  1, 167,  33, },      /* Save */
  496. X!       { 33,  1, 255,  33, },      /* Show all */
  497. X!       { 44,  1, 318,  33, },      /* Suggest */
  498. X!       { 55,  1, 403,  33, },      /* Undo */
  499. X!       { -1, -1,  33,  75, },      /* Done   (not displayed). */
  500. X!       { -1, -1, 318,  75, },      /* Cancel (not displayed). */
  501. X!       { -1, -1, 403,  75, },      /* Quit   (not displayed). */
  502. X!       { 38,  5,  15, 114, },      /* Black: */
  503. X!       { 38,  7, 237, 114, },      /* White: */
  504. X!       { 38,  9,  15, 156, },      /* Difficuly: */
  505. X!       { 38, 11, 237, 156, },      /* Notes: */
  506. X        { -1, -1,  -1,  -1, },      /* Panel message. */
  507. X        { -1, -1,  -1,  -1, },      /* Notes message. */
  508. X        { -1, -1,  -1,  -1, },      /* Score message. */
  509. X        { -1, -1,  -1,  -1, },      /* Turn message. */
  510. X  } ;
  511. X  
  512. X  struct other_info {   /* Information needed to place other text values. */
  513. X--- 62,91 ----
  514. X  } ;
  515. X  
  516. X  struct tty_info ttyvals[MAXITEMS] = {
  517. X!       {  1,  1,  43,  32, },      /* Load */
  518. X!       { 11,  1, 117,  32, },      /* Moves? */
  519. X!       { 22,  1, 191,  32, },      /* New game */
  520. X!       { 33,  1, 265,  32, },      /* Save */
  521. X!       { 44,  1, 339,  32, },      /* Suggest */
  522. X!       { 55,  1, 413,  32, },      /* Undo */
  523. X!       { -1, -1,  43,  74, },      /* Props  (not displayed). */
  524. X!       { -1, -1, 339,  74, },      /* Cancel (not displayed). */
  525. X!       { -1, -1, 413,  74, },      /* Quit   (not displayed). */
  526. X!       { 60,  5,  15, 111, },      /* Black: */
  527. X!       { 60,  7, 237, 111, },      /* White: */
  528. X        { -1, -1,  -1,  -1, },      /* Panel message. */
  529. X        { -1, -1,  -1,  -1, },      /* Notes message. */
  530. X        { -1, -1,  -1,  -1, },      /* Score message. */
  531. X        { -1, -1,  -1,  -1, },      /* Turn message. */
  532. X+       { -1, -1,  -1,  -1, },      /* Computer choice.: */
  533. X+       { -1, -1,  -1,  -1, },      /* Difficulty. */
  534. X+       { -1, -1,  -1,  -1, },      /* Maximum search depth. */
  535. X+       { -1, -1,  -1,  -1, },      /* Animate option: */
  536. X+       { -1, -1,  -1,  -1, },      /* Best computer move option. */
  537. X+       { -1, -1,  -1,  -1, },      /* Last move option. */
  538. X+       { -1, -1,  -1,  -1, },      /* Show evaluation option. */
  539. X+       { -1, -1,  -1,  -1, },      /* Number move option. */
  540. X+       { -1, -1,  -1,  -1, },      /* Quick game option. */
  541. X  } ;
  542. X  
  543. X  struct other_info {   /* Information needed to place other text values. */
  544. X***************
  545. X*** 91,112 ****
  546. X  
  547. X  struct other_info othervals[MAXITEMS] = {
  548. X        { -1, -1, },       /* Load     (ignored). */
  549. X        { -1, -1, },       /* New game (ignored). */
  550. X        { -1, -1, },       /* Save     (ignored). */
  551. X-       { -1, -1, },       /* Show all (ignored). */
  552. X        { -1, -1, },       /* Suggest  (ignored). */
  553. X        { -1, -1, },       /* Undo     (ignored). */
  554. X        { -1, -1, },       /* Done     (ignored). */
  555. X        { -1, -1, },       /* Cancel   (ignored). */
  556. X        { -1, -1, },       /* Quit     (ignored). */
  557. X!       { 60,  5, },       /* Black: */
  558. X!       { 60,  7, },       /* White: */
  559. X!       { 60,  9, },       /* Difficuly: */
  560. X!       { 60, 11, },       /* Notes: */
  561. X        { 38, 13, },       /* Panel message. */
  562. X        { 38, 15, },       /* Notes message. */
  563. X        { 38, 17, },       /* Score message. */
  564. X        { 38, 19, },       /* Turn message. */
  565. X  } ;
  566. X  
  567. X  
  568. X--- 95,123 ----
  569. X  
  570. X  struct other_info othervals[MAXITEMS] = {
  571. X        { -1, -1, },       /* Load     (ignored). */
  572. X+       { -1, -1, },       /* Moves?   (ignored). */
  573. X        { -1, -1, },       /* New game (ignored). */
  574. X        { -1, -1, },       /* Save     (ignored). */
  575. X        { -1, -1, },       /* Suggest  (ignored). */
  576. X        { -1, -1, },       /* Undo     (ignored). */
  577. X        { -1, -1, },       /* Done     (ignored). */
  578. X        { -1, -1, },       /* Cancel   (ignored). */
  579. X        { -1, -1, },       /* Quit     (ignored). */
  580. X!       { 38,  5, },       /* Black: */
  581. X!       { 38,  7, },       /* White: */
  582. X        { 38, 13, },       /* Panel message. */
  583. X        { 38, 15, },       /* Notes message. */
  584. X        { 38, 17, },       /* Score message. */
  585. X        { 38, 19, },       /* Turn message. */
  586. X+       { -1, -1, },       /* Computer choice. */
  587. X+       { 60,  9, },       /* Difficulty. */
  588. X+       { -1, -1, },       /* Maximum search depth. */
  589. X+       { -1, -1, },       /* Animate option: */
  590. X+       { -1, -1, },       /* Best computer move option. */
  591. X+       { -1, -1, },       /* Last move option. */
  592. X+       { 60, 11, },       /* Show evaluation option. */
  593. X+       { -1, -1, },       /* Number move option. */
  594. X+       { -1, -1, },       /* Quick game option. */
  595. X  } ;
  596. X  
  597. X  
  598. X***************
  599. X*** 131,137 ****
  600. X  
  601. X  /*ARGSUSED*/
  602. X  void
  603. X! color_area(x, y, width, height, color)
  604. X  int x, y, width, height, color ;
  605. X  {
  606. X    char nextline[MAXLINE] ;
  607. X--- 142,149 ----
  608. X  
  609. X  /*ARGSUSED*/
  610. X  void
  611. X! color_area(wtype, x, y, width, height, color)
  612. X! enum win_type wtype ;
  613. X  int x, y, width, height, color ;
  614. X  {
  615. X    char nextline[MAXLINE] ;
  616. X***************
  617. X*** 175,189 ****
  618. X  }
  619. X  
  620. X  
  621. X- /*ARGSUSED*/
  622. X  void
  623. X- create_menu(mtype, values)     /* Create popup menus - null routine. */
  624. X- enum panel_type mtype ;
  625. X- char *values[] ;
  626. X- {}
  627. X- 
  628. X- 
  629. X- void
  630. X  destroy_frame()       /* Destroy reve window. */
  631. X  {
  632. X    tputs(CL, 1, outc) ;
  633. X--- 187,193 ----
  634. X***************
  635. X*** 200,213 ****
  636. X  }
  637. X  
  638. X  
  639. X- /*ARGSUSED*/
  640. X- do_menu(mtype)                /* Popup appropriate menu - not used. */
  641. X- enum panel_type mtype ;
  642. X- {
  643. X-   return 0 ;
  644. X- }
  645. X- 
  646. X- 
  647. X  static void
  648. X  do_standend()                 /* Finish inverted area. */
  649. X  {
  650. X--- 204,209 ----
  651. X***************
  652. X*** 224,230 ****
  653. X  
  654. X  /*ARGSUSED*/
  655. X  void
  656. X! draw_image(x, y, width, height, image)    /* Null routine. */
  657. X  int x, y, width, height ;
  658. X  enum image_type image ;
  659. X  {}
  660. X--- 220,227 ----
  661. X  
  662. X  /*ARGSUSED*/
  663. X  void
  664. X! draw_image(wtype, x, y, width, height, image)    /* Null routine. */
  665. X! enum win_type wtype ;
  666. X  int x, y, width, height ;
  667. X  enum image_type image ;
  668. X  {}
  669. X***************
  670. X*** 232,238 ****
  671. X  
  672. X  /*ARGSUSED*/
  673. X  void
  674. X! draw_line(x1, y1, x2, y2, op, color)
  675. X  int x1, y1, x2, y2, color ;
  676. X  enum optype op ;
  677. X  {
  678. X--- 229,236 ----
  679. X  
  680. X  /*ARGSUSED*/
  681. X  void
  682. X! draw_line(wtype, x1, y1, x2, y2, op, color)
  683. X! enum win_type wtype ;
  684. X  int x1, y1, x2, y2, color ;
  685. X  enum optype op ;
  686. X  {
  687. X***************
  688. X*** 258,264 ****
  689. X  
  690. X  /*ARGSUSED*/
  691. X  void
  692. X! draw_stencil(x, y, width, height, op, color, stencil, image)
  693. X  int x, y, width, height, color ;
  694. X  enum optype op ;
  695. X  enum image_type stencil, image ;
  696. X--- 256,263 ----
  697. X  
  698. X  /*ARGSUSED*/
  699. X  void
  700. X! draw_stencil(wtype, x, y, width, height, op, color, stencil, image)
  701. X! enum win_type wtype ;
  702. X  int x, y, width, height, color ;
  703. X  enum optype op ;
  704. X  enum image_type stencil, image ;
  705. X***************
  706. X*** 317,323 ****
  707. X  
  708. X  /*ARGSUSED*/
  709. X  void
  710. X! draw_text(x, y, ftype, color, str)
  711. X  enum font_type ftype ;
  712. X  int x, y, color ;
  713. X  char *str ;
  714. X--- 316,323 ----
  715. X  
  716. X  /*ARGSUSED*/
  717. X  void
  718. X! draw_text(wtype, x, y, ftype, color, str)
  719. X! enum win_type wtype ;
  720. X  enum font_type ftype ;
  721. X  int x, y, color ;
  722. X  char *str ;
  723. X***************
  724. X*** 339,348 ****
  725. X        return ;
  726. X      }
  727. X  
  728. X! /* Check for the four panel message types. */
  729. X  
  730. X!   else if (x == 15 && y == 195)        /* Panel message. */
  731. X      {
  732. X        if (EQUAL(str, "Use left"))
  733. X          STRCPY(str, "Select a letter/number pair for a move") ;
  734. X        draw_string(othervals[(int) PANEL_MES].column,
  735. X--- 339,360 ----
  736. X        return ;
  737. X      }
  738. X  
  739. X! /* Check for the six panel message types. */
  740. X  
  741. X!   else if (x == 15 && y == 111)        /* Black: message. */
  742. X      {
  743. X+       draw_string(othervals[(int) BLACK_PLAYS].column,
  744. X+                   othervals[(int) BLACK_PLAYS].row, str, FALSE) ;
  745. X+       return ;
  746. X+     }
  747. X+   else if (x == 237 && y == 111)       /* White: message. */
  748. X+     {
  749. X+       draw_string(othervals[(int) WHITE_PLAYS].column,
  750. X+                   othervals[(int) WHITE_PLAYS].row, str, FALSE) ;
  751. X+       return ;
  752. X+     }
  753. X+   else if (x == 15 && y == 153)        /* Panel message. */
  754. X+     {
  755. X        if (EQUAL(str, "Use left"))
  756. X          STRCPY(str, "Select a letter/number pair for a move") ;
  757. X        draw_string(othervals[(int) PANEL_MES].column,
  758. X***************
  759. X*** 349,361 ****
  760. X                    othervals[(int) PANEL_MES].row, str, TRUE) ;
  761. X        return ;
  762. X      }
  763. X!   else if (x == 15 && y == 237)       /* Note message. */
  764. X      {
  765. X        draw_string(othervals[(int) EVAL_MES].column,
  766. X                    othervals[(int) EVAL_MES].row, str, TRUE) ;
  767. X        return ;
  768. X      }
  769. X!   else if (x == 15 && y == 279)        /* Score message. */
  770. X      {
  771. X        if (sscanf(str, "Stones: Black: %d White: %d", &black, &white) == 2)
  772. X          SPRINTF(str, "Black (O): %d, White (X): %d", black, white) ;
  773. X--- 361,373 ----
  774. X                    othervals[(int) PANEL_MES].row, str, TRUE) ;
  775. X        return ;
  776. X      }
  777. X!   else if (x == 15 && y == 195)       /* Evaluation message. */
  778. X      {
  779. X        draw_string(othervals[(int) EVAL_MES].column,
  780. X                    othervals[(int) EVAL_MES].row, str, TRUE) ;
  781. X        return ;
  782. X      }
  783. X!   else if (x == 15 && y == 237)        /* Score message. */
  784. X      {
  785. X        if (sscanf(str, "Stones: Black: %d White: %d", &black, &white) == 2)
  786. X          SPRINTF(str, "Black (O): %d, White (X): %d", black, white) ;
  787. X***************
  788. X*** 363,369 ****
  789. X                    othervals[(int) SCORE_MES].row, str, TRUE) ;
  790. X        return ;
  791. X      }
  792. X!   else if (x == 237 && y == 279)       /* Turn message. */
  793. X      {
  794. X        draw_string(othervals[(int) TURN_MES].column,
  795. X                    othervals[(int) TURN_MES].row, str, TRUE) ;
  796. X--- 375,381 ----
  797. X                    othervals[(int) SCORE_MES].row, str, TRUE) ;
  798. X        return ;
  799. X      }
  800. X!   else if (x == 237 && y == 237)       /* Turn message. */
  801. X      {
  802. X        draw_string(othervals[(int) TURN_MES].column,
  803. X                    othervals[(int) TURN_MES].row, str, TRUE) ;
  804. X***************
  805. X*** 370,378 ****
  806. X        return ;
  807. X      }
  808. X  
  809. X  /* Check for panel and cyclic items. */
  810. X  
  811. X!   for (i = 0; i < MAXITEMS-4; i++)
  812. X      if (EQUAL(str, items[i].text))
  813. X        if (ttyvals[i].column != -1)
  814. X          {
  815. X--- 382,405 ----
  816. X        return ;
  817. X      }
  818. X  
  819. X+ /* Check for the two player strings. */
  820. X+ 
  821. X+   else if (x == 163 && y == 111)       /* Black plays: value. */
  822. X+     {
  823. X+       draw_string(ttyvals[(int) BLACK_PLAYS].column,
  824. X+                   ttyvals[(int) BLACK_PLAYS].row, str, TRUE) ;
  825. X+       return ;
  826. X+     }
  827. X+   else if (x == 385 && y == 111)       /* White plays: value. */
  828. X+     {
  829. X+       draw_string(ttyvals[(int) WHITE_PLAYS].column,
  830. X+                   ttyvals[(int) WHITE_PLAYS].row, str, TRUE) ;
  831. X+       return ;
  832. X+     }
  833. X+ 
  834. X  /* Check for panel and cyclic items. */
  835. X  
  836. X!   for (i = 0; i < MAXITEMS-13; i++)
  837. X      if (EQUAL(str, items[i].text))
  838. X        if (ttyvals[i].column != -1)
  839. X          {
  840. X***************
  841. X*** 389,399 ****
  842. X  
  843. X    switch (y)
  844. X      {
  845. X!       case 111  : if (x == 182) pt = BLACK_PLAYS ;      /* Black plays. */
  846. X                    else          pt = WHITE_PLAYS ;      /* White plays. */
  847. X                    break ;
  848. X!       case 153  : if (x == 182) pt = DIFFICULTY ;       /* Difficulty. */
  849. X!                   else          pt = NOTES ;            /* Notes. */
  850. X                    break ;
  851. X        default   : return ;   /* We're not interested in this piece of text. */
  852. X      }
  853. X--- 416,426 ----
  854. X  
  855. X    switch (y)
  856. X      {
  857. X!       case 111  : if (x == 163) pt = BLACK_PLAYS ;      /* Black plays. */
  858. X                    else          pt = WHITE_PLAYS ;      /* White plays. */
  859. X                    break ;
  860. X!       case 153  : if (x == 163) pt = DIFF_CHOICE ;      /* Difficulty. */
  861. X!                   else          pt = OPT_EVAL ;         /* Notes. */
  862. X                    break ;
  863. X        default   : return ;   /* We're not interested in this piece of text. */
  864. X      }
  865. X***************
  866. X*** 413,418 ****
  867. X--- 440,453 ----
  868. X  }
  869. X   
  870. X   
  871. X+ char *
  872. X+ get_resource(rtype)      /* Null routine (currently only X11 and XView). */
  873. X+ enum res_type rtype ;
  874. X+ {
  875. X+   return((char *) NULL) ;
  876. X+ }
  877. X+ 
  878. X+ 
  879. X  /*ARGSUSED*/
  880. X  get_strwidth(ftype, str)    /* Get width in pixels of string value. */
  881. X  enum font_type ftype ;
  882. X***************
  883. X*** 430,435 ****
  884. X--- 465,477 ----
  885. X  }
  886. X  
  887. X  
  888. X+ init_graphics(argc, argv)
  889. X+ int *argc ;
  890. X+ char *argv[] ;
  891. X+ {
  892. X+ }
  893. X+ 
  894. X+ 
  895. X  init_ws_type()
  896. X  {
  897. X    char bp[1024], termtype[MAXLINE] ;
  898. X***************
  899. X*** 456,461 ****
  900. X--- 498,509 ----
  901. X  }
  902. X  
  903. X  
  904. X+ void
  905. X+ load_resources()     /* Dummy routine; used with X11 and XView versions. */
  906. X+ {
  907. X+ }
  908. X+ 
  909. X+ 
  910. X  /*ARGSUSED*/
  911. X  void
  912. X  lock_screen(state)     /* Graphics locking - null routine. */
  913. X***************
  914. X*** 489,494 ****
  915. X--- 537,550 ----
  916. X  {}
  917. X  
  918. X  
  919. X+ /*ARGSUSED*/
  920. X+ void
  921. X+ open_frame(wtype)
  922. X+ enum win_type wtype ;
  923. X+ {
  924. X+ }
  925. X+ 
  926. X+ 
  927. X  static void
  928. X  outc(c)                 /* Output the next character to the screen. */
  929. X  register int c ;
  930. X***************
  931. X*** 532,539 ****
  932. X    for (;;)
  933. X      {
  934. X        get_event() ;          /* Get next canvas event. */
  935. X!       process_event() ;      /* Find out what kind it is. */
  936. X!       handle_event() ;       /* And do the apropriate action. */
  937. X      }
  938. X  }
  939. X  
  940. X--- 588,594 ----
  941. X    for (;;)
  942. X      {
  943. X        get_event() ;          /* Get next canvas event. */
  944. X!       handle_event() ;       /* And do the appropriate action. */
  945. X      }
  946. X  }
  947. X  
  948. X
  949. X------- x11.c -------
  950. X*** /tmp/da07675    Sun Dec  9 15:20:14 1990
  951. X--- x11.c    Sat Dec  8 19:50:52 1990
  952. X***************
  953. X*** 27,32 ****
  954. X--- 27,34 ----
  955. X  #include "color.h"
  956. X  #include "extern.h"
  957. X  #include "images.h"
  958. X+ #include <ctype.h>
  959. X+ #include <sys/param.h>
  960. X  #include <sys/time.h>
  961. X  
  962. X  #include <X11/Xlib.h>
  963. X***************
  964. X*** 35,40 ****
  965. X--- 37,43 ----
  966. X  #include <X11/Xos.h>
  967. X  #include <X11/cursorfont.h>
  968. X  #include <X11/keysym.h>
  969. X+ #include <X11/Xresource.h>
  970. X  
  971. X  #define  BOLDFONT    "lucidasanstypewriter-bold-12"
  972. X  #define  DEFFONT     "fixed"
  973. X***************
  974. X*** 44,50 ****
  975. X                        EnterWindowMask | KeyPressMask      | LeaveWindowMask | \
  976. X                        PointerMotionMask)
  977. X  
  978. X! #define  OTHELLO_BORDER_WIDTH  2
  979. X  
  980. X  enum gr_type gtype = GX11 ;        /* Graphics type. */
  981. X  
  982. X--- 47,53 ----
  983. X                        EnterWindowMask | KeyPressMask      | LeaveWindowMask | \
  984. X                        PointerMotionMask)
  985. X  
  986. X! #define  REVE_BORDER_WIDTH  2
  987. X  
  988. X  enum gr_type gtype = GX11 ;        /* Graphics type. */
  989. X  
  990. X***************
  991. X*** 60,71 ****
  992. X  Pixmap images[MAXIMAGES] ;
  993. X  Pixmap no_pixmap ;
  994. X  Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
  995. X! Window frame[MAXDPY], root[MAXDPY] ;
  996. X  XClassHint class_hint = { "reve", "Reve" } ;
  997. X  XColor BGcolor, FGcolor ;
  998. X  XEvent event ;
  999. X  XFontStruct *font[MAXFONTS] ;
  1000. X! XSizeHints size ;
  1001. X  XWMHints wm_hints ;
  1002. X  XGCValues gc_val ;              /* Used to setup graphics context values. */
  1003. X  int gc_flags ;                  /* Used to set up graphics context flags. */
  1004. X--- 63,75 ----
  1005. X  Pixmap images[MAXIMAGES] ;
  1006. X  Pixmap no_pixmap ;
  1007. X  Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
  1008. X! Window frame[MAXDPY], pframe[MAXDPY], root[MAXDPY] ;
  1009. X  XClassHint class_hint = { "reve", "Reve" } ;
  1010. X  XColor BGcolor, FGcolor ;
  1011. X  XEvent event ;
  1012. X  XFontStruct *font[MAXFONTS] ;
  1013. X! XrmDatabase reve_DB[MAXDPY] ;   /* Combined resources database. */
  1014. X! XSizeHints psize, size ;
  1015. X  XWMHints wm_hints ;
  1016. X  XGCValues gc_val ;              /* Used to setup graphics context values. */
  1017. X  int gc_flags ;                  /* Used to set up graphics context flags. */
  1018. X***************
  1019. X*** 139,154 ****
  1020. X  
  1021. X  
  1022. X  void
  1023. X! close_frame()            /* Iconise reve window. */
  1024. X  {
  1025. X    int d ;
  1026. X    XEvent event ;
  1027. X  
  1028. X    d = (int) cur_dpyno ;
  1029. X    iconic = 1 ;
  1030. X    event.xclient.type = ClientMessage ;
  1031. X    event.xclient.display = dpy[d] ;
  1032. X!   event.xclient.window = frame[d] ;
  1033. X    event.xclient.message_type = XInternAtom(dpy[d], "WM_CHANGE_STATE", False) ;
  1034. X    event.xclient.format = 32 ;
  1035. X    event.xclient.data.l[0] = IconicState ;
  1036. X--- 143,163 ----
  1037. X  
  1038. X  
  1039. X  void
  1040. X! close_frame(wtype)            /* Iconise reve window. */
  1041. X! enum win_type wtype ;
  1042. X  {
  1043. X    int d ;
  1044. X    XEvent event ;
  1045. X+   Window window ;
  1046. X  
  1047. X    d = (int) cur_dpyno ;
  1048. X+   if (wtype == W_MAIN) window = frame[d] ;
  1049. X+   else                 window = pframe[d] ;
  1050. X+ 
  1051. X    iconic = 1 ;
  1052. X    event.xclient.type = ClientMessage ;
  1053. X    event.xclient.display = dpy[d] ;
  1054. X!   event.xclient.window = window ;
  1055. X    event.xclient.message_type = XInternAtom(dpy[d], "WM_CHANGE_STATE", False) ;
  1056. X    event.xclient.format = 32 ;
  1057. X    event.xclient.data.l[0] = IconicState ;
  1058. X***************
  1059. X*** 158,169 ****
  1060. X  
  1061. X  
  1062. X  void
  1063. X! color_area(x, y, width, height, color)
  1064. X  int x, y, width, height, color ;
  1065. X  {
  1066. X    int d ;
  1067. X  
  1068. X    d = (int) cur_dpyno ;
  1069. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1070. X    else
  1071. X      { 
  1072. X--- 167,181 ----
  1073. X  
  1074. X  
  1075. X  void
  1076. X! color_area(wtype, x, y, width, height, color)
  1077. X! enum win_type wtype ;
  1078. X  int x, y, width, height, color ;
  1079. X  {
  1080. X+   Window window ;
  1081. X    int d ;
  1082. X  
  1083. X    d = (int) cur_dpyno ;
  1084. X+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
  1085. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1086. X    else
  1087. X      { 
  1088. X***************
  1089. X*** 172,191 ****
  1090. X      }
  1091. X    gc_val.function = GXcopy ;
  1092. X    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
  1093. X!   XFillRectangle(dpy[d], frame[d], gc[d], x, y,
  1094. X                   (unsigned int) width, (unsigned int) height) ;
  1095. X  }
  1096. X  
  1097. X  
  1098. X- /*ARGSUSED*/
  1099. X  void
  1100. X- create_menu(mtype, values)    /* Create the various popup menus. */
  1101. X- enum panel_type mtype ;
  1102. X- char *values[] ;
  1103. X- {}
  1104. X- 
  1105. X- 
  1106. X- void
  1107. X  destroy_frame()          /* Destroy reve window. */
  1108. X  {
  1109. X    XDestroyWindow(dpy[(int) cur_dpyno], frame[(int) cur_dpyno]) ;
  1110. X--- 184,195 ----
  1111. X      }
  1112. X    gc_val.function = GXcopy ;
  1113. X    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
  1114. X!   XFillRectangle(dpy[d], window, gc[d], x, y,
  1115. X                   (unsigned int) width, (unsigned int) height) ;
  1116. X  }
  1117. X  
  1118. X  
  1119. X  void
  1120. X  destroy_frame()          /* Destroy reve window. */
  1121. X  {
  1122. X    XDestroyWindow(dpy[(int) cur_dpyno], frame[(int) cur_dpyno]) ;
  1123. X***************
  1124. X*** 192,230 ****
  1125. X  }
  1126. X  
  1127. X  
  1128. X- /*ARGSUSED*/
  1129. X- do_menu(mtype)          /* Display popup menu for cyclic item. */
  1130. X- enum item_type mtype ;
  1131. X- {
  1132. X-   return(0) ;
  1133. X- }
  1134. X- 
  1135. X- 
  1136. X  void
  1137. X! draw_image(x, y, width, height, image)
  1138. X  int x, y, width, height ;
  1139. X  enum image_type image ;
  1140. X  {
  1141. X    int d ;
  1142. X  
  1143. X    d = (int) cur_dpyno ;
  1144. X    gc_mask = GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
  1145. X    gc_val.stipple = images[(int) image] ;
  1146. X    gc_val.ts_x_origin = x ;
  1147. X    gc_val.ts_y_origin = y ;
  1148. X    XChangeGC(dpy[d], ropgc[d], gc_mask, &gc_val) ;
  1149. X!   XFillRectangle(dpy[d], frame[d], ropgc[d], x, y, width, height) ;
  1150. X  }
  1151. X  
  1152. X  
  1153. X  void
  1154. X! draw_line(x1, y1, x2, y2, op, color)
  1155. X  int x1, y1, x2, y2, color ;
  1156. X  enum optype op ;
  1157. X  {
  1158. X    int d ;
  1159. X  
  1160. X    d = (int) cur_dpyno ;
  1161. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1162. X    else
  1163. X      {
  1164. X--- 196,232 ----
  1165. X  }
  1166. X  
  1167. X  
  1168. X  void
  1169. X! draw_image(wtype, x, y, width, height, image)
  1170. X! enum win_type wtype ;
  1171. X  int x, y, width, height ;
  1172. X  enum image_type image ;
  1173. X  {
  1174. X+   Window window ;
  1175. X    int d ;
  1176. X  
  1177. X    d = (int) cur_dpyno ;
  1178. X+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
  1179. X    gc_mask = GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
  1180. X    gc_val.stipple = images[(int) image] ;
  1181. X    gc_val.ts_x_origin = x ;
  1182. X    gc_val.ts_y_origin = y ;
  1183. X    XChangeGC(dpy[d], ropgc[d], gc_mask, &gc_val) ;
  1184. X!   XFillRectangle(dpy[d], window, ropgc[d], x, y, width, height) ;
  1185. X  }
  1186. X  
  1187. X  
  1188. X  void
  1189. X! draw_line(wtype, x1, y1, x2, y2, op, color)
  1190. X! enum win_type wtype ;
  1191. X  int x1, y1, x2, y2, color ;
  1192. X  enum optype op ;
  1193. X  {
  1194. X+   Window window ;
  1195. X    int d ;
  1196. X  
  1197. X    d = (int) cur_dpyno ;
  1198. X+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
  1199. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1200. X    else
  1201. X      {
  1202. X***************
  1203. X*** 233,251 ****
  1204. X      }
  1205. X    gc_val.function = opvals[(int) op] ;
  1206. X    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
  1207. X!   XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
  1208. X  }
  1209. X  
  1210. X  
  1211. X  void
  1212. X! draw_stencil(x, y, width, height, op, color, stencil, image)
  1213. X  int x, y, width, height, color ;
  1214. X  enum optype op ;
  1215. X  enum image_type stencil, image ;
  1216. X  {
  1217. X    int d ;
  1218. X  
  1219. X    d = (int) cur_dpyno ;
  1220. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1221. X    else            gc_val.foreground = foregnd[d] ;
  1222. X    gc_val.function = opvals[(int) op] ;
  1223. X--- 235,256 ----
  1224. X      }
  1225. X    gc_val.function = opvals[(int) op] ;
  1226. X    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
  1227. X!   XDrawLine(dpy[d], window, gc[d], x1, y1, x2, y2) ;
  1228. X  }
  1229. X  
  1230. X  
  1231. X  void
  1232. X! draw_stencil(wtype, x, y, width, height, op, color, stencil, image)
  1233. X! enum win_type wtype ;
  1234. X  int x, y, width, height, color ;
  1235. X  enum optype op ;
  1236. X  enum image_type stencil, image ;
  1237. X  {
  1238. X+   Window window ;
  1239. X    int d ;
  1240. X  
  1241. X    d = (int) cur_dpyno ;
  1242. X+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
  1243. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1244. X    else            gc_val.foreground = foregnd[d] ;
  1245. X    gc_val.function = opvals[(int) op] ;
  1246. X***************
  1247. X*** 259,277 ****
  1248. X              GCClipXOrigin | GCClipYOrigin |
  1249. X              GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
  1250. X    XChangeGC(dpy[d], stencilgc[d], gc_mask, &gc_val) ;
  1251. X!   XFillRectangle(dpy[d], frame[d], stencilgc[d], x, y, width, height) ;
  1252. X  }
  1253. X  
  1254. X  
  1255. X  void
  1256. X! draw_text(x, y, ftype, color, str)
  1257. X  enum font_type ftype ;
  1258. X  int x, y, color ;
  1259. X  char *str ;
  1260. X  {
  1261. X    int d ;
  1262. X  
  1263. X    d = (int) cur_dpyno ;
  1264. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1265. X    else
  1266. X      { 
  1267. X--- 264,285 ----
  1268. X              GCClipXOrigin | GCClipYOrigin |
  1269. X              GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
  1270. X    XChangeGC(dpy[d], stencilgc[d], gc_mask, &gc_val) ;
  1271. X!   XFillRectangle(dpy[d], window, stencilgc[d], x, y, width, height) ;
  1272. X  }
  1273. X  
  1274. X  
  1275. X  void
  1276. X! draw_text(wtype, x, y, ftype, color, str)
  1277. X! enum win_type wtype ;
  1278. X  enum font_type ftype ;
  1279. X  int x, y, color ;
  1280. X  char *str ;
  1281. X  {
  1282. X+   Window window ;
  1283. X    int d ;
  1284. X  
  1285. X    d = (int) cur_dpyno ;
  1286. X+   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
  1287. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1288. X    else
  1289. X      { 
  1290. X***************
  1291. X*** 281,287 ****
  1292. X    gc_val.font = font[(int) ftype]->fid ;
  1293. X    gc_val.function = GXcopy ;
  1294. X    XChangeGC(dpy[d], gc[d], GCFont | GCForeground | GCFunction, &gc_val) ;
  1295. X!   XDrawString(dpy[d], frame[d], gc[d], x, y, str, strlen(str)) ;
  1296. X  }
  1297. X   
  1298. X   
  1299. X--- 289,295 ----
  1300. X    gc_val.font = font[(int) ftype]->fid ;
  1301. X    gc_val.function = GXcopy ;
  1302. X    XChangeGC(dpy[d], gc[d], GCFont | GCForeground | GCFunction, &gc_val) ;
  1303. X!   XDrawString(dpy[d], window, gc[d], x, y, str, strlen(str)) ;
  1304. X  }
  1305. X   
  1306. X   
  1307. X***************
  1308. X*** 313,318 ****
  1309. X--- 321,346 ----
  1310. X  }
  1311. X  
  1312. X  
  1313. X+ char *
  1314. X+ get_resource(rtype)      /* Get Reve resource from merged databases. */
  1315. X+ enum res_type rtype ;
  1316. X+ {
  1317. X+   char cstr[MAXLINE], nstr[MAXLINE], str[MAXLINE] ;
  1318. X+   char *str_type[20] ;
  1319. X+   int d ;
  1320. X+   XrmValue value ;
  1321. X+ 
  1322. X+   d = (int) cur_dpyno ;
  1323. X+   STRCPY(str, resources[(int) rtype]) ;
  1324. X+   SPRINTF(nstr,  "reve.%s", str) ;
  1325. X+   if (islower(str[0])) str[0] = toupper(str[0]) ;
  1326. X+   SPRINTF(cstr, "Reve.%s", str) ;
  1327. X+   if (XrmGetResource(reve_DB[d], nstr, cstr, str_type, &value) == NULL)
  1328. X+     return((char *) NULL) ;
  1329. X+   else return(value.addr) ;
  1330. X+ }
  1331. X+ 
  1332. X+ 
  1333. X  get_strwidth(ftype, str)    /* Get width in pixels of string value. */
  1334. X  enum font_type ftype ;
  1335. X  char *str ;
  1336. X***************
  1337. X*** 357,362 ****
  1338. X--- 385,400 ----
  1339. X  }
  1340. X  
  1341. X  
  1342. X+ /*ARGSUSED*/
  1343. X+ init_graphics(argc, argv)
  1344. X+ int *argc ;
  1345. X+ char *argv[] ;
  1346. X+ {
  1347. X+   dpy[(int) DPY1] = XOpenDisplay((char *) NULL) ;
  1348. X+   reve_DB[(int) DPY1] = NULL ;
  1349. X+ }
  1350. X+ 
  1351. X+ 
  1352. X  init_ws_type()
  1353. X  {
  1354. X  #ifndef NOSELECT
  1355. X***************
  1356. X*** 382,387 ****
  1357. X--- 420,427 ----
  1358. X    images[(int) CY_STENCIL]  = load_image(cycle_stencil_image) ;
  1359. X    images[(int) CY_LINVERT]  = load_image(cycle_linvert_image) ;
  1360. X    images[(int) CY_RINVERT]  = load_image(cycle_rinvert_image) ;
  1361. X+   images[(int) TOGGLE_ON]   = load_image(sch_on_image) ;
  1362. X+   images[(int) TOGGLE_OFF]  = load_image(sch_off_image) ;
  1363. X    images[(int) P_WHITE]     = load_image(white_image) ;
  1364. X    images[(int) P_BLACK]     = load_image(black_image) ;
  1365. X  
  1366. X***************
  1367. X*** 472,477 ****
  1368. X--- 512,578 ----
  1369. X  }
  1370. X  
  1371. X  
  1372. X+ /*  Get the resource databases. These are looked for in the following ways:
  1373. X+  *
  1374. X+  *  Classname file in the app-defaults directory. In this case, Classname
  1375. X+  *  is Reve.
  1376. X+  *
  1377. X+  *  Classname file in the directory specified by the XUSERFILESEARCHPATH
  1378. X+  *  or XAPPLRESDIR environment variable.
  1379. X+  *
  1380. X+  *  Property set using xrdb, accessible through the XResourceManagerString
  1381. X+  *  macro or, if that is empty, the ~/.Xdefaults file.
  1382. X+  *
  1383. X+  *  XENVIRONMENT environment variable or, if not set, .Xdefaults-hostname
  1384. X+  *  file.
  1385. X+  */
  1386. X+ 
  1387. X+ void
  1388. X+ load_resources()
  1389. X+ { 
  1390. X+   XrmDatabase db ;
  1391. X+   char *home, name[MAXPATHLEN], *ptr ;
  1392. X+   int d, len ;
  1393. X+   
  1394. X+   d = (int) cur_dpyno ;
  1395. X+   home = getenv("HOME") ;
  1396. X+   XrmInitialize() ;
  1397. X+   STRCPY(name, "/usr/lib/X11/app-defaults/Reve") ;
  1398. X+   
  1399. X+ /* Get applications defaults file, if any. */
  1400. X+   
  1401. X+   db = XrmGetFileDatabase(name) ;
  1402. X+   XrmMergeDatabases(db, &reve_DB[d]) ;
  1403. X+ 
  1404. X+ /* Merge server defaults, created by xrdb. If nor defined, use ~/.Xdefaults. */
  1405. X+ 
  1406. X+ #ifndef X11R3
  1407. X+   if (XResourceManagerString(dpy[d]) != NULL)
  1408. X+     db = XrmGetStringDatabase(XResourceManagerString(dpy[d])) ;
  1409. X+   else
  1410. X+ #endif /*X11R3*/
  1411. X+     { 
  1412. X+       SPRINTF(name, "%s/.Xdefaults", home) ;
  1413. X+       db = XrmGetFileDatabase(name) ;
  1414. X+     }
  1415. X+   XrmMergeDatabases(db, &reve_DB[d]) ;
  1416. X+ 
  1417. X+ /*  Open XENVIRONMENT file or, if not defined, the .Xdefaults, and merge
  1418. X+  *  into existing database.
  1419. X+  */
  1420. X+ 
  1421. X+   if ((ptr = getenv("XENVIRONMENT")) == NULL)
  1422. X+     {
  1423. X+       SPRINTF(name, "%s/.Xdefaults-", home) ;
  1424. X+       len = strlen(name) ;
  1425. X+       GETHOSTNAME(name+len, 1024-len) ;
  1426. X+       db = XrmGetFileDatabase(name) ;
  1427. X+     }
  1428. X+   else db = XrmGetFileDatabase(ptr) ;
  1429. X+   XrmMergeDatabases(db, &reve_DB[d]) ;
  1430. X+ }
  1431. X+ 
  1432. X+ 
  1433. X  /*ARGSUSED*/
  1434. X  void
  1435. X  lock_screen(state)     /* Turn graphics locking on or off - null routine. */
  1436. X***************
  1437. X*** 528,534 ****
  1438. X  
  1439. X    frame[d] = XCreateSimpleWindow(dpy[d], root[d],
  1440. X                                   size.x, size.y, size.width, size.height,
  1441. X!                                  OTHELLO_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
  1442. X  
  1443. X    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
  1444. X    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
  1445. X--- 629,635 ----
  1446. X  
  1447. X    frame[d] = XCreateSimpleWindow(dpy[d], root[d],
  1448. X                                   size.x, size.y, size.width, size.height,
  1449. X!                                  REVE_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
  1450. X  
  1451. X    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
  1452. X    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
  1453. X***************
  1454. X*** 552,557 ****
  1455. X--- 653,676 ----
  1456. X  
  1457. X    XSetClassHint(dpy[d], frame[d], &class_hint) ;
  1458. X  
  1459. X+ /*  Setup property window. */
  1460. X+ 
  1461. X+   psize.flags = PMinSize | PMaxSize | PPosition | PSize ;
  1462. X+   psize.x = TOTAL_WIDTH + 10 ;
  1463. X+   psize.y = 0 ;
  1464. X+   psize.max_width = size.min_width = size.width = PROPS_WIDTH ;
  1465. X+   psize.max_height = size.min_height = size.height = PROPS_HEIGHT ;
  1466. X+ 
  1467. X+   pframe[d] = XCreateSimpleWindow(dpy[d], root[d],
  1468. X+                                   size.x + TOTAL_WIDTH + 10, size.y,
  1469. X+                                   PROPS_WIDTH, PROPS_HEIGHT,
  1470. X+                                   REVE_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
  1471. X+ 
  1472. X+   XSetStandardProperties(dpy[d], pframe[d], "reve properties",
  1473. X+                          "Props", reve_icon[d], argv, argc, &psize) ;
  1474. X+ 
  1475. X+ /* Create graphics contexts. */
  1476. X+ 
  1477. X    gc_mask = GCForeground | GCBackground | GCGraphicsExposures ;
  1478. X    gc_val.foreground = foregnd[d] ;
  1479. X    gc_val.background = backgnd[d] ;
  1480. X***************
  1481. X*** 600,605 ****
  1482. X--- 719,739 ----
  1483. X  
  1484. X  
  1485. X  void
  1486. X+ open_frame(wtype)
  1487. X+ enum win_type wtype ;
  1488. X+ {
  1489. X+   int d ;
  1490. X+   Window window ;
  1491. X+ 
  1492. X+   d = (int) cur_dpyno ;
  1493. X+   if (wtype == W_MAIN) window = frame[d] ;
  1494. X+   else                 window = pframe[d] ;
  1495. X+   XSelectInput(dpy[0], window, FRAME_MASK) ;
  1496. X+   XMapWindow(dpy[0], window) ;
  1497. X+ }
  1498. X+ 
  1499. X+ 
  1500. X+ void
  1501. X  process_event()         /* Determine event type. */
  1502. X  {
  1503. X    XClientMessageEvent *ev ;
  1504. X***************
  1505. X*** 609,614 ****
  1506. X--- 743,751 ----
  1507. X    int d ;
  1508. X  
  1509. X    d = (int) cur_dpyno ; 
  1510. X+        if (event.xany.window == frame[(int) cur_dpyno])  curwin = W_MAIN ;
  1511. X+   else if (event.xany.window == pframe[(int) cur_dpyno]) curwin = W_PROPS ;
  1512. X+ 
  1513. X    switch (event.type)
  1514. X      {
  1515. X        case ClientMessage    : /* Catch ICCCM kill from WM. */
  1516. X***************
  1517. X*** 669,683 ****
  1518. X  XExposeEvent *event ;
  1519. X  {
  1520. X    int d ;
  1521. X!   int doframe = 0 ;
  1522. X  
  1523. X    d = (int) cur_dpyno ;
  1524. X    do
  1525. X!     if (event->count == 0 && event->window == frame[(int) cur_dpyno])
  1526. X!       doframe++ ;
  1527. X    while (XCheckMaskEvent(dpy[d], ExposureMask, (XEvent *) event)) ;
  1528. X  
  1529. X!   return(doframe ? FRAME_REPAINT : IGNORE_EVENT) ;
  1530. X  }
  1531. X  
  1532. X  
  1533. X--- 806,827 ----
  1534. X  XExposeEvent *event ;
  1535. X  {
  1536. X    int d ;
  1537. X!   int doframe  = 0 ;
  1538. X!   int dopframe = 0 ;
  1539. X  
  1540. X    d = (int) cur_dpyno ;
  1541. X    do
  1542. X!     {
  1543. X!       if (event->count == 0 && event->window == frame[(int) cur_dpyno])
  1544. X!         doframe++ ;
  1545. X!       if (event->count == 0 && event->window == pframe[(int) cur_dpyno])
  1546. X!         dopframe++ ;
  1547. X!     }
  1548. X    while (XCheckMaskEvent(dpy[d], ExposureMask, (XEvent *) event)) ;
  1549. X  
  1550. X!        if (doframe)  return(FRAME_REPAINT) ;
  1551. X!   else if (dopframe) return(PROPS_REPAINT) ;
  1552. X!   else               return(IGNORE_EVENT) ;
  1553. X  }
  1554. X  
  1555. X  
  1556. X***************
  1557. X*** 697,709 ****
  1558. X  start_tool(dtype)            /* Start event dispatcher and display. */
  1559. X  enum disp_type dtype ;
  1560. X  {
  1561. X!   XSelectInput(dpy[0], frame[0], FRAME_MASK) ;
  1562. X!   XMapWindow(dpy[0], frame[0]) ;
  1563. X  
  1564. X    if (dtype == XTWO)
  1565. X      {
  1566. X        XSelectInput(dpy[1], frame[1], FRAME_MASK) ;
  1567. X        XMapWindow(dpy[1], frame[1]) ;
  1568. X      }
  1569. X  
  1570. X    if (dtype == XTWO) Xselect_input() ;
  1571. X--- 841,854 ----
  1572. X  start_tool(dtype)            /* Start event dispatcher and display. */
  1573. X  enum disp_type dtype ;
  1574. X  {
  1575. X!   open_frame(W_MAIN) ;
  1576. X!   XSelectInput(dpy[0], pframe[0], FRAME_MASK) ;
  1577. X  
  1578. X    if (dtype == XTWO)
  1579. X      {
  1580. X        XSelectInput(dpy[1], frame[1], FRAME_MASK) ;
  1581. X        XMapWindow(dpy[1], frame[1]) ;
  1582. X+       XSelectInput(dpy[1], pframe[1], FRAME_MASK) ;
  1583. X      }
  1584. X  
  1585. X    if (dtype == XTWO) Xselect_input() ;
  1586. X
  1587. END_OF_FILE
  1588. if test 41748 -ne `wc -c <'patches03e'`; then
  1589.     echo shar: \"'patches03e'\" unpacked with wrong size!
  1590. fi
  1591. # end of 'patches03e'
  1592. fi
  1593. echo shar: End of archive 8 \(of 9\).
  1594. cp /dev/null ark8isdone
  1595. MISSING=""
  1596. for I in 1 2 3 4 5 6 7 8 9 ; do
  1597.     if test ! -f ark${I}isdone ; then
  1598.     MISSING="${MISSING} ${I}"
  1599.     fi
  1600. done
  1601. if test "${MISSING}" = "" ; then
  1602.     echo You have unpacked all 9 archives.
  1603.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1604. else
  1605.     echo You still need to unpack the following archives:
  1606.     echo "        " ${MISSING}
  1607. fi
  1608. ##  End of shell archive.
  1609. exit 0
  1610.